package com.grass.cropTradingCenter.domain;

import com.grass.cropTradingCenter.domain.repository.OrderRepository;
import com.grass.cropTradingCenter.pojo.entity.UserOrder;
import com.grass.cropTradingCenter.service.domain.OrderDomainService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class OrderDomainServiceImpl implements OrderDomainService {
    @Autowired
    OrderRepository orderRepository;

    @Override
    public void save(UserOrder order) {
        if (order.getId() == null || order.getId() == 0) {
            orderRepository.save(order);
            return;
        }
        orderRepository.update(order);
    }
}
